knitr::opts_chunk$set(echo = FALSE) requireNamespace("pmxTools") library(PKNCA) library(dplyr) library(ggplot2) library(tidyr) library(purrr) breaks_hours <- function(n=5, Q=c(1, 6, 4, 12, 2, 24, 168), ...) { n_default <- n Q_default <- Q function(x, n = n_default, Q=Q_default) { x <- x[is.finite(x)] if (length(x) == 0) { return(numeric()) } rng <- range(x) labeling::extended(rng[1], rng[2], m=n, Q=Q, ...) } } scale_x_hours <- function(..., breaks=breaks_hours()) { ggplot2::scale_x_continuous(..., breaks=breaks) }
The data for the exercise are from a PK study of amikacin in a killer whale and a beluga whale. (DOI: 10.1638/03-078)
(Callback...)
Load the files from the "Hands-on 1_Whale PK" directory, group the data by the "Animal" column, and perform NCA calculations to derive typical parameters such as AUClast, Cmax, and Tmax.
library(PKNCA) library(tidyverse) d_conc <- read.csv("2023-10-18-Project D files/Hands-on 1_Whale PK/whale_conc.csv") d_dose <- read.csv("2023-10-18-Project D files/Hands-on 1_Whale PK/whale_dose.csv") head(d_conc) head(d_dose) o_conc <- PKNCAconc(concentration~time|Animal, data=d_conc) o_dose <- PKNCAdose(dose~time|Animal, data=d_dose) o_data <- PKNCAdata(o_conc, o_dose) o_data$intervals o_nca <- pk.nca(o_data) summary(o_nca) summary(o_nca, drop.group=c()) as.data.frame(o_nca)
# Load PKNCA library(PKNCA) # Load the data (you may have to adjust the file location based on where you # saved the files on your computer) d_conc <- read.csv("2023-10-18-Project D files/Hands-on 1_Whale PK/whale_conc.csv") d_dose <- read.csv("2023-10-18-Project D files/Hands-on 1_Whale PK/whale_dose.csv") # Look at the data head(d_conc) head(d_dose) # What PKNCAconc() arguments do you need to provide the concentration data to # PKNCA? Fill in between the parentheses with the correct arguments. o_conc <- PKNCAconc() # What PKNCAdose() arguments do you need to provide the dose data to PKNCA? # Fill in between the parentheses with the correct arguments. o_dose <- PKNCAdose() # What PKNCAdata() arguments do you need to put the prepared PKNCAconc and # PKNCAdose objects? Do you need to add an `intervals` argument? Fill in # between the parentheses with the correct arguments. o_data <- PKNCAdata() # What pk.nca() argument do you need to perform the NCA calculations? o_nca <- pk.nca() # What command do you use to get a summary of the NCA calculations? # What command do you use to get all individual NCA calculations?
Objective: Calculate day 1 and steady-state NCA from a single dataset.
# Load PKNCA library(tidyverse) library(PKNCA) # Load the data (you may have to adjust the file location based on where you # saved the files on your computer) d_conc <- read.csv("2023-10-18-Project D files/Hands-on 2_Multiple dosing/multidose.csv") # Look at the data head(d_conc) # See what times are available in the data? d_conc %>% select(time, Day) %>% unique() %>% arrange(time) # Use this PKNCAconc command to separate by study day o_conc <- PKNCAconc(data = d_conc, conc~time|Subject) # What PKNCAdata() arguments do you need to put the prepared PKNCAconc object # and what intervals do you need to specify? Fill in between the parentheses # with the correct arguments. d_intervals <- data.frame( start = c(0, 120), end = c(24, 144), # insert the parameters to calculate here aucint.inf.obs = TRUE, cmax = TRUE, tmax = TRUE ) o_data <- PKNCAdata(o_conc, intervals = d_intervals) o_nca <- pk.nca(o_data) # Look at your results summary(o_nca)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.